package com.neuedu.corejava.ch4.practise;

public class ArraySort {
	
	    public static void sortArray()
	    {
	        int[] myList = new int[] {1,6,2,3,9,4,5,7,8};
	        java.util.Arrays.sort(myList);
	        System.out.println(java.util.Arrays.toString(myList));
	    }
	    
	    public static void bubbleSortArray()
	    {
	        int[] myList = new int[] {1,6,2,3,9,4,5,7,8};
	        for(int i = 0;i < myList.length -1; i++) {
	            for(int j = 0;j < myList.length - 1 -i;j++) {
	                if(myList[j] > myList[j + 1]) {
	                    int temp = myList[j];
	                    myList[j] = myList[j +1];
	                    myList[j + 1] = temp;
	                }
	            }
	        }
	        System.out.println(java.util.Arrays.toString(myList));
	    }
	    public static void main(String[] args) {
	        sortArray();//3
	        bubbleSortArray();//3

	    } 
}
